package com.hualan.zhsq.controller.car;

import com.hualan.zhsq.entity.car.PaymentMethod;
import com.hualan.zhsq.service.car.PaymentMethodService;
import com.hualan.zhsq.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName PaymentMethodController
 * @Description 支付方式controller
 * @Author ZheRan
 * @Date 2025年08月04日 下午7:30
 * @Version 1.0
 */
@RestController
public class PaymentMethodController {
    @Autowired
    private PaymentMethodService paymentMethodService;

    //新增一条数据
    @PostMapping("/paymentMethod/add")
    public Result add(@RequestBody PaymentMethod paymentMethod) {
        return Result.success(paymentMethodService.add(paymentMethod));
    }

    //修改一条数据
    @PutMapping("/paymentMethod/edit")
    public Result edit(@RequestBody PaymentMethod paymentMethod) {
        return Result.success(paymentMethodService.edit(paymentMethod));
    }

    //根据id逻辑删除一条数据
    @DeleteMapping("/paymentMethod/remove/{id}")
    public Result remove(@PathVariable Integer id) {
        return Result.success(paymentMethodService.remove(id));
    }

    //批量逻辑删除
    @DeleteMapping("/paymentMethod/removeBatch")
    public Result removeBatch( Integer[] ids) {
        return Result.success(paymentMethodService.removeBatch(ids));
    }

    //根据id查询一条数据
    @GetMapping("/paymentMethod/findById/{id}")
    public Result findById(@PathVariable Integer id) {
        return Result.success(paymentMethodService.findById(id));
    }

    //查询所有数据
    @GetMapping("/paymentMethod/findPage")
    public Result findPage() {
        return Result.success(paymentMethodService.findPage(1, 10, new PaymentMethod()));
    }
}
